﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form2 : Form
    {
      

        public Form2()
        {
            InitializeComponent();
        }

       

        private void Form2_Load(object sender, EventArgs e)
        {

        }


        /// <summary>
        /// 确认保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            var name = textBox1.Text;
            var age = textBox2.Text;
            var sex = textBox3.Text;
            var score = textBox4.Text;

           

            //添加
            
            
                var sql = string.Format("insert into Students values ('{0}','{1}','{2}','{3}')", name, age, sex, score);
                DBhelper.AddOrUpdateOrdelete(sql);

                MessageBox.Show("添加成功","提示");
            

            this.DialogResult = DialogResult.Yes;
            this.Close();
        }
    }
}
